package com.myspring.test;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * author:
 * Date:2024/1/80:21
 **/
public class demo {
	/**
	 * date: 2021/5/13 * @author csp * 测试主函数类
	 */

	public static void main(String[] args) {
		// 读取spring配置文件

		ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring-test.xml");
		// 获取service的bean对象

		UserService userService = (UserService) context.getBean("userService");
		// 执行service方法查询user对象
		User user = userService.getUserById(1);
		// 输出user结果
		System.out.println(user);
	}
}
